<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <!-- 变量 -->
    <!-- <script>
        var myname = '测试';
        // console.log(myname);
        myname = '第二个测试';
        console.log(myname);
    </script> -->
   <!--  <script>
        // 声明多个变量写法1
        var demo1 = '测试1',demo3 = '测试2',demo3 = '测试3';
        // 声明多个变量的写法2
        var demo1 = '测试1',
            demo2 = '测试2',
            demo3 = '测试3';
        console.log(demo1);
        console.log(demo2);
        console.log(demo3);
    </script> -->
    <!-- <script>
        var a;
        console.log(a); //结果为undefined
    </script> -->
    <!-- <script>
        console.log(a);
    </script> -->
    <!-- <script>
        var tel;
        var name;
        console.log(tel);
        console.log(name);
    </script> -->
    <script>
        //1、首先先建立一个临时变量
        // 2、把a给临时变量temp
        // 3、把b给临时变量a
        // 4、把temp变量再给b
        var a = '第一个变量';
        var b = '第二个变量';
        var temp;   //声明一个为空的变量
        temp = a;   //把a给临时变量temp
        a = b;      //把b给临时变量a
        b = temp;   //把temp变量再给b
        console.log(a);
        console.log(b);
    </script>
</head>
<body>
    <h1>变量</h1>
</body>
</html>